/* 
 * CECellMatrix
 *
 */

#import "CECellMatrix.h"
#import "CEBrowserCell.h"

@implementation CECellMatrix

- mouseDown:(NXEvent *)theEvent
{
	id	theCell;
	int	row;
	int	col;
	
	NXPoint	theSpot;
	
	theSpot.x = (theEvent->location).x;
	theSpot.y = (theEvent->location).y;
	[self convertPoint:&theSpot fromView:nil];
	
	// It is IMPORTANT that we really use row and col here.
	// The matrix method has a BUG which would return a wrong
	// cell if we use only one int for both values.
	// It seams to use them internally to store the row/col infos!!
	
	theCell = [self getRow:&row andCol:&col forPoint:&theSpot];
	
	if( theCell != nil && 
		[theCell respondsTo:@selector(mouseDown:forView:)] )
		{
			if( [theCell mouseDown:theEvent forView:self] == nil ) 
				return self;
		}
	
	return [super mouseDown:theEvent];
}

- (BOOL)acceptsFirstResponder
{
	return YES;
}

@end
